package com.yuhq;


import com.yuhq.model.UserTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;

//运行spring环境
@RunWith(SpringJUnit4ClassRunner.class)
//指定spring配置文件
@ContextConfiguration("classpath:applicationContext.xml")
public class SpringMyBatisTestAutowire {

//    private ApplicationContext context;
//
//    @Before
//    public void init() {
//        context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
//    }


    @Resource
    private UserTest userTest;


    @Test
    public void testSpring() {
//        Date date = (Date) context.getBean("date");
//        System.err.println(date.hashCode());
        System.out.println(userTest);
    }

}
